package feesmodule.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author Oleg
 */
@Entity
@Table(name="DOMAIN_DEFINITION")
public class DomainDefinition implements Serializable
{
    @Id()
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "DEFINITION_ID")
    private int id;
    @Column(name = "DOMAIN_VALUE")
    private String domainValue;

    @ManyToMany(mappedBy = "values")
    private Set<ConditionElement> conditionElemenents = new HashSet<ConditionElement>();

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="TYPE_DEF_ID")
    private TypeDefinition domainType;


    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }



    /**
     * @return the domainValue
     */
    public String getDomainValue() {
        return domainValue;
    }

    /**
     * @param domainValue the domainValue to set
     */
    public void setDomainValue(String domainValue) {
        this.domainValue = domainValue;
    }

    /**
     * @return the domainType
     */
    public TypeDefinition getDomainType() {
        return domainType;
    }

    /**
     * @param domainType the domainType to set
     */
    public void setDomainType(TypeDefinition domainType) {
        this.domainType = domainType;
    }

    /**
     * @return the conditionElemenents
     */
    public Set<ConditionElement> getConditionElemenents() {
        return conditionElemenents;
    }

    /**
     * @param conditionElemenents the conditionElemenents to set
     */
    public void setConditionElemenents(Set<ConditionElement> conditionElemenents) {
        this.conditionElemenents = conditionElemenents;
    }

}
